<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Clipper2Z - ES6 - Example Basic</title>
	<script src="../drawPath.js"></script>
</head>
<body>
	<script type="module">
		import Clipper2ZFactory from '../../dist/es/clipper2z.js';

		Clipper2ZFactory().then((Clipper2Z) => {
			initCanvas(500, 500);

			/* C++:
			Paths64 subject, clip, solution;
			subject.push_back(MakePath({100, 50, 10, 79, 65, 2, 65, 98, 10, 21}));
			clip.push_back(MakePath({98, 63, 4, 68, 77, 8, 52, 100, 19, 12}));
			solution = Intersect(subject, clip, FillRule::NonZero);
			*/

			const { MakePath64, Paths64, FillRule, Intersect64 } = Clipper2Z;
			const subject = new Paths64();
			const clip = new Paths64();
			subject.push_back(MakePath64([100, 50, 10, 79, 65, 2, 65, 98, 10, 21]));
			clip.push_back(MakePath64([98, 63, 4, 68, 77, 8, 52, 100, 19, 12]));
			const solution = Intersect64(subject, clip, FillRule.NonZero);

			// comment out the draw subject and clip to see the solution only
			drawPaths(subject, 'green');
			drawPaths(clip, 'red');

			drawPaths(solution, 'blue');
		});
	</script>
</body>
</html>
